package com.spc.car.web.controller.std;

import com.spc.car.core.framework.web.domain.AjaxResult;
import com.spc.car.data.service.std.StdGbOrgTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.Pattern;

@Api(tags = "机构类型")
@RestController
@Validated
@Slf4j
@RequestMapping("/stdGbOrgType")
public class StdGbOrgTypeController {

    @Autowired
    private StdGbOrgTypeService stdGbOrgTypeService;

    @ApiOperation(value = "获取机构类型列表", notes = "获取机构类型列表")
    @GetMapping("/listStdGbOrgType")
    public AjaxResult ListGbOrgType(@Pattern(regexp = "[0-9]{3}", message = "请输入机构类型编码")
                                        @RequestParam(required = false) String parentCode){
        return AjaxResult.success(stdGbOrgTypeService.listStdGbOrgTypeByParentCode(parentCode));
    }

}
